nanoseconds(x::Time24) = value(x)
microseconds(x::Time24) = div(nanoseconds(x), NANOSECONDS_PER_MICROSECOND)
milliseconds(x::Time24) = div(nanoseconds(x), NANOSECONDS_PER_MILLISECOND)
seconds(x::Time24) = div(nanoseconds(x), NANOSECONDS_PER_SECOND)
minutes(x::Time24) = div(nanoseconds(x), NANOSECONDS_PER_MINUTE)
quarterhours(x::Time24) = div(nanoseconds(x), NANOSECONDS_PER_QUARTERHOUR)
hours(x::Time24) = div(nanoseconds(x), NANOSECONDS_PER_HOUR)

Nanoseconds(x::Time24) = Nanoseconds(nanoseconds(x))
Microseconds(x::Time24) = Microseconds(microseconds(x))
Milliseconds(x::Time24) = Microseconds(microseconds(x))
Seconds(x::Time24) = Seconds(seconds(x))
Minutes(x::Time24) = Minutes(minutes(x))
QuarterHours(x::Time24) = QuarterHours(quarterhours(x))
Hours(x::Time24) = Hours(hours(x))

function Time24(x::Nanoseconds)
    nanosecs = nanoseconds(x)
    if signbit(nanosecs) || nanosecs > NANOSECONDS_PER_DAY
       throw(ErrorException("nanoseconds are out of bounds for Time24"))
    end
    return Time24(nanosecs)
end

Time24(x::Microseconds) = Time24(Nanoseconds(x))
Time24(x::Milliseconds) = Time24(Nanoseconds(x))
Time24(x::Seconds) = Time24(Nanoseconds(x))
Time24(x::Minutes) = Time24(Nanoseconds(x))
Time24(x::QuarterHours) = Time24(Nanoseconds(x))
Time24(x::Hours) = Time24(Nanoseconds(x))
